package com.huishen.edrivenew.base;


import com.huishen.edrivenew.AppManager;
import com.huishen.edrivenew.widget.LoadingDialog;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;

/**
 * activity基类
 *
 * @author wu
 * @version 2015/6/29.
 */
public class BaseActivity extends Activity {
    
    public LoadingDialog  dialog ;
    
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        AppManager.getInstance().addActivity(this);
    }
    
    
    public void showDialog() {
        if(dialog == null) {
            dialog = new LoadingDialog(this);
        }
        if(!dialog.isShowing()) {
            dialog.show();
        }
    }
    
    public void dismissDialog() {
        try{
            if(dialog!=null && dialog.isShowing()) {
                dialog.dismiss();
            }
        } catch(Exception e) {
        }
    }
    
    
    public void showToast(String text) {
        Toast.makeText(this, text, Toast.LENGTH_SHORT).show();
    }
    
    
    
    
}
